﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using HNCDataSetTableAdapters;
using System.Web.Routing;

public partial class UserControl_content_product : System.Web.UI.UserControl
{
    CategoryTableAdapter cate = new CategoryTableAdapter();
    ProductsTableAdapter pro = new ProductsTableAdapter();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int CateID = int.Parse(HttpContext.Current.Request.RequestContext.RouteData.Values["CateID"].ToString());
            DataTable dt1 = cate.GetCateByCateID(CateID);
            lblTitle.Text = FuntionHNC.GetLanguage(dt1.Rows[0]["Title"].ToString(), dt1.Rows[0]["Title_en"].ToString());

            
            DataTable dt = pro.GetProductByCateID(CateID);
            rptProduct.DataSource = dt;
            rptProduct.DataBind();

            //lblTitle.Text = dt.Rows[0]["Title"].ToString();

            //DataView dv = (DataView)pro.GetProductByCateID(CateID).DefaultView;
            //CollectionPager1.PageSize = 18;
            //CollectionPager1.DataSource = dv;
            //CollectionPager1.BindToControl = rptProduct;
            //rptProduct.DataSource = CollectionPager1.DataSourcePaged;
            //rptProduct.DataBind();
        }
    }
}